﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;
using System.Data.SqlClient;

namespace ERPForms
{
    public partial class TipDimensiuneFrm : FrmRezumat
    {
        public TipDimensiuneFrm(ModuleClass mInfo)
            : base(mInfo)
        {
            InitializeComponent();
            workConnString = "ESRPConnectionString";
            tipFormatDimensiuneBindingSource.Add(new TipFormatDimensiune("Text", "TX"));
            tipFormatDimensiuneBindingSource.Add(new TipFormatDimensiune("Selectie", "SL"));
            eSRPDataSet.TipDimensiune.FormatColumn.DefaultValue = "SL";
        }

        private void TipDimensiuneFrm_Load(object sender, EventArgs e)
        {
            SqlConnection con = DeschideConexiune(workConnString);
            this.tipDimensiuneTableAdapter.Connection = con;
            this.tipDimensiuneTableAdapter.Fill(this.eSRPDataSet.TipDimensiune);
            InchideConexiune(con);
            AddBindingSource(tipDimensiuneBindingSource);
            listTableAdaptor.Add(this.tipDimensiuneTableAdapter.Adapter);
            HandleSalvare += Salvare;
        }
    }

    [Serializable]
    public class TipFormatDimensiune
    {
        public TipFormatDimensiune(String nume, String tag)
        {
            _Name = nume;
            _Tag = tag;
        }

        private String _Name = String.Empty;
        [System.ComponentModel.Bindable(true)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }
        private String _Tag = String.Empty;
        [System.ComponentModel.Bindable(true)]
        public String Tag
        {
            get
            {
                return _Tag;
            }
            set
            {
                _Tag = value;
            }
        }
    }
}
